package edu.wfu.preparedDishes.order.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import edu.wfu.preparedDishes.commodity.entity.MerchantEntity;
import edu.wfu.preparedDishes.commodity.service.MerchantService;
import edu.wfu.preparedDishes.order.dao.MerchantOrderDao;
import edu.wfu.preparedDishes.order.entity.po.MerchantOrderEntity;
import edu.wfu.preparedDishes.order.entity.vo.MerchantOrderEntityVo;
import edu.wfu.preparedDishes.order.service.MerchantOrderService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class MerchantOrderServiceImpl extends ServiceImpl<MerchantOrderDao, MerchantOrderEntity> implements MerchantOrderService {

    @Autowired
    private MerchantOrderDao merchantOrderDao;
    @Autowired
    MerchantService merchantService;

    @Override
    public List<MerchantOrderEntityVo> getMerchantOrder(Integer userId) {
            Long l = Long.valueOf(userId);
            MerchantEntity merchantByUserId = merchantService.getMerchantByUserId(l);
            return merchantOrderDao.getOrderMerchantListByMerId(merchantByUserId.getMerchantId());
        }
    }
